/**
 * Created by kaki on 2017/9/21.
 */
import fetch from '@/utils/fetch'

export const GetTable = (page, per_page = 10, keyword) => {
  return fetch({
    url: '/api/staff',
    method: 'get',
    params: {
      page,
      per_page,
      keyword
    }
  })
}

export const Delete = (id) => {
  return fetch({
    url: `/api/staff/${id}`,
    method: 'delete'
  })
}

export const Show = (id) => {
  return fetch({
    url: `/api/staff/${id}`,
    method: 'get'
  })
}

export const Update = (id, data) => {
  return fetch({
    url: `/api/staff/${id}`,
    method: 'put',
    params: data
  })
}

export const Publish = (id) => {
  return fetch({
    url: `/api/staff/${id}/publish`,
    method: 'post'
  })
}

export const Create = (data) => {
  return fetch({
    url: `/api/staff`,
    method: 'post',
    params: data
  })
}

export const editPassword = (uuid, password) => {
  return fetch({
    url: `/api/staff/${uuid}/password`,
    method: 'put',
    data: {
      password
    }
  })
}
